import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';

export type RoleDocument = Role & Document;

@Schema({
  timestamps: {
    createdAt: 'createdAt',
    updatedAt: 'updatedAt',
  },
})
export class Role extends Document {
  // 角色名称
  @Prop({ type: String })
  roleName: string;

  // 是否是系统管理员角色
  @Prop({ default: false })
  isAdminRole: false;

  // 角色权限Code
  @Prop({ type: [String], default: [] })
  permissionsCode: string[];

  // 角色权限Name
  @Prop({ type: [String], default: [] })
  permissionsName: string[];

  // 是否删除
  @Prop({ default: false })
  isDelete: false;
}

export const RoleSchema = SchemaFactory.createForClass(Role);
